package com.ruoyi.quartz.task;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Service;

import java.net.HttpCookie;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Slf4j
@Service
public class MJiaoYiMaoApiImpl  {

    static String  jymId = "jym013171055115445217292203233657937930033dbafe631b14146a7e9d641ec1f04b3";
    static String  umidToken = "T2gAjjmnwIGHO2fECtUQ4HEp699of9S5P6iRPqTudVKB6OFdPl69Woe16qrqYID9aiw=";

    public static void main(String[] args) {


//        String jymId = "jym013171055115445217292203233657937930033dbafe631b14146a7e9d641ec1f04b3";
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        log.info("获取到的_m_h5_tk={}", _m_h5_tk);

        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String  _m_h5_tk_enc = m_h5_tk_enc.getValue();
        log.info("_m_h5_tk_enc={}", _m_h5_tk_enc);

        String cookie = "cna=ELz2HdeMWE0CASrvtv8g0GPP; ssids=2151706171272252; logTraceJymId=7979a277a8f7-4ac1-9673-c5c5; track_id=gcmall_1706171272984_20badffa-bff2-468c-ab69-2b489280641e; t=760ce99ede3c17ff4a9854e748e95e99; _bl_uid=bwlgXrU5va1gdbxgmtp0q9ys9p3p; aplus_ieu_ch=10438; ctoken=QLk4nT7MY9W1Ms_5x8BEH0po; _m_h5_tk=" + _m_h5_tk +"; _m_h5_tk_enc=" + _m_h5_tk_enc + "; xlly_s=1; Hm_lvt_47366dcc92e834539e7e9c3dcc2441de=1707798155,1709021805; _samesite_flag_=true; cookie2=1ac5b7e20db0c4ed82b1b12864f05c97; _tb_token_=e6b53b3379018; ieu_member_biz_id=jiaoyimao; csg=ce33c43a; ieu_member_uid=1544521729220323; jym_session_id=" + jymId +"; ieu_member_sid="+jymId+"; actk=1861a9538d288c8d8ab3a3466972eeee; sfroms=JIAOYIMALL001; external_login_type=2; ssts=960d7b2550750c2473c6488c47426b8c; actks=dc50e594cc88972d7e4b0db1f1fca1b7; EGG_SESS=3v6DgAB-jKbLOzN5Qa1pFi5yHoQKYp1Php5wCXl9Vy7Ix_eco_QOS_jC-0TzxDVnsrktE84L7AheQVsGJ4JQDb6KKG_EzHd85uOlGxc2-IHSUPiqfgb0GIfF9hjMQCbp; session=1709023162661780-9; t_id=0dba2a925449-4eae-96c5-db943e8d4475; p_id=351ffa81d09b-4556-8063-bef2b0a68739; Hm_lpvt_47366dcc92e834539e7e9c3dcc2441de=1709023449; tfstk=ewuMjDAeYcr6NwRmFAU6JOYzhAxpUPa_uIDYH-h4352QQlhqDE4mLfcTXhatx-DEKRrv1NhduxDE6N3xoD_mNjg91rd_5fabuLpJy-cs1r_aP9_pykTLlJpJeULLVcT0NLnOOHjRYkSFJzpxzwE_E_brTJuJSLes_JbosJVaMGwYKZ7qHDcLUUehuZu3sgSlYgWS6ZwJ-jsfclPQt8nOGOEyttDyZBAhqXraOWoDtBjfclPQt8dHtgcUbWNEm; isg=BP7-vrQ6F3QlpUI3-qcVXCpCTxRAP8K5s6p_XqgHQcOsS8QlcM4xy1NtxxGH87rR";
//        String cookie = "cna=ELz2HdeMWE0CASrvtv8g0GPP; ssids=2151706171272252; logTraceJymId=7979a277a8f7-4ac1-9673-c5c5; track_id=gcmall_1706171272984_20badffa-bff2-468c-ab69-2b489280641e; t=760ce99ede3c17ff4a9854e748e95e99; aplus_ieu_ch=10438; xlly_s=1; ctoken=_BKPA7641QulA46SSpYekq_d; Hm_lvt_47366dcc92e834539e7e9c3dcc2441de=1707798155,1709021805,1709364549,1709603879; _m_h5_tk=" +  _m_h5_tk +"; _m_h5_tk_enc="  + _m_h5_tk_enc + "; _samesite_flag_=true; cookie2=15780183c7d259ec425ce0f1688b80d4; _tb_token_=383717ae3ee1; t_id=1a700fcabb93-4102-9092-ecb3b70c244d; csg=c0bb3545; ieu_member_uid=1544521729220323; ieu_member_biz_id=jiaoyimao; jym_session_id= " + jymId +"; ieu_member_sid=jym0131709604154452172922032300939771900b96ed3d94903365844d64c5f3c06f539; Hm_lpvt_47366dcc92e834539e7e9c3dcc2441de=1709604015; tfstk=erZy0fMxFgIyYGYVBqmE7DJ5-9i-b0fsxkGIKJ2nFbcuFJbFYWNvF8w5yWz4tS3SZ2tQgBP0MktSq8iU8WNTP2qIOkWE2oaWAb1-YJVsY111fGw8eVnh111FtiHnvMmzGqs_e8pDyuDRnGteai7OYdDHrhLqWeeSioZIK8IwcMapxHqlb4laeet6fokrwk2ogYM70YursgJH9xxQ9kEdveuoHxl13t-oV2JcrLAgBeLKP1Dq1txJJe3oHxl13t8pJ41i3f6D2; isg=BPn5j_hWuA7JPWXGqQ5qvUmrCGXTBu24MFMYjxsuZCAXojs0Y1fsiRWwIKBUGoXw";

//        withdraw(cookie,_m_h5_tk);
//        edit(cookie,_m_h5_tk);
//        down(cookie,_m_h5_tk,"1709588472498005");
//        add(cookie);//保证金卖家上架
//        addUser(cookie);//普通用户上架
        bacthDown(cookie,_m_h5_tk);
    }

    private static void addUser(String cookie) {


        String createGoods = "https://m.jiaoyimao.com/api2/sellerPublish/createGoods";
        String  data = "{\"keyProperties\":[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\",\"defaultValue\":1701247154492446}],\"extProperties\":[],\"sellerAccountProperties\":[{\"propertyId\":1696673988443741,\"value\":\"1343701877\"},{\"propertyId\":1696673988465744,\"value\":\"qwer..0011\"},{\"propertyId\":1696673989059869,\"value\":\"15225247351\"}],\"safeProperties\":[],\"performanceProperties\":[],\"goodsSellingScene\":[],\"fulfillmentSelect\":[],\"title\":\"商品标题将由系统生成\",\"price\":\"8888\",\"description\":\"不想玩了，弃游\",\"storage\":\"1\",\"gameProperty\":{\"platformId\":\"3\",\"pid\":1,\"cid\":\"1696673988415737\",\"clientId\":\"1470047031280559\",\"gameId\":1002416,\"isNineGameAccount\":false,\"isLingXiAccount\":false,\"isAliGameAccount\":false,\"isTransfer\":false,\"platformName\":\"苹果\",\"serverId\":1701247154492446,\"isFinishAccount\":true,\"categoryName\":\"QQ帐号\"},\"modelType\":\"H5\",\"categoryId\":\"1696673988415737\",\"addlService\":{\"supportBargain\":false},\"publishMode\":6,\"securityModelType\":\"h5_ios\",\"publishSceneId\":\"officialCustody\",\"goodsDefTravelContent\":\"{\\\"forceBargain\\\":true}\"}";
//        JSONObject data = new JSONObject();
        //服务器
        JSONObject tags = new JSONObject();
        tags.put("tagCode","gameServer");


         cookie = "cna=ELz2HdeMWE0CASrvtv8g0GPP; ssids=2151706171272252; logTraceJymId=7979a277a8f7-4ac1-9673-c5c5; track_id=gcmall_1706171272984_20badffa-bff2-468c-ab69-2b489280641e; t=760ce99ede3c17ff4a9854e748e95e99; _bl_uid=bwlgXrU5va1gdbxgmtp0q9ys9p3p; aplus_ieu_ch=10438; ctoken=If0dKjpAmx-g-zc4j4HMUCZ7; session=5151710311657095; t_id=f8a8e604f367-472e-b47d-6132498b28b9; xlly_s=1; Hm_lvt_47366dcc92e834539e7e9c3dcc2441de=1709021805,1709364549,1709603879,1710311660; _m_h5_tk=8514869a9aaccd8aa11626b6a7df1547_1710319938433; _m_h5_tk_enc=361d7c7b9c01c15d5fdd6bd2fdbb5f04; _samesite_flag_=true; cookie2=1a676be822670360bd405188909b3086; _tb_token_=3eb53e93a30e9; csg=b0b76f56; ieu_member_uid=1674019816629475; ieu_member_biz_id=jiaoyimao; jym_session_id=jym0131710311167401981662947574018074500a3399542969b5c673f9cb1f64ea6f5a2; ieu_member_sid=jym0131710311167401981662947574018074500a3399542969b5c673f9cb1f64ea6f5a2; EGG_SESS=3v6DgAB-jKbLOzN5Qa1pFi5yHoQKYp1Php5wCXl9Vy7Ix_eco_QOS_jC-0TzxDVne8UcTLLJQ58yjBoe2zxj9kU6suGMEwzlnNcZyFBFOZ1A4qgCiChEVv-UefdFVWXN; p_id=92474f4c60ae-44c4-bc76-23db9cdd6d7c; Hm_lpvt_47366dcc92e834539e7e9c3dcc2441de=1710311833; STALKER_USER_ID_KEY=1674019816629475; STALKER_PROD_NO_KEY=27620; STALKER_OUTER_APP_NAME_KEY=JIAO_YI_MAO; _TRACERT_COOKIE__SESSION=d273c67c-c8f3-4d6c-bf4d-fae98bce285c; isg=BDQ0Dwq77ZYAIXgRXFX_wrTQBfKmDVj3fZjl-M6Vyb9YOcODqRwNhZK_vXfhwZBP; tfstk=eLpDXMiraI5jA8oMREBjEMLo6tG-jo61WFeOWOQZaa75M1R9MOYMDEfxctKNSFYRP1dYHOwNsUT0HFpMfRjwbFifWmGJcn61Q23dSvKXcJtXM0kK_YKfrOuKJYheG1sFQIIJ1vIUovi1kj97es_3vs9CmO3xVNKVrJxc6i5aGU_uQR8vZ17Epa2aQLjc4YVzTytYCwHkf5N1ggslJIE_k6ouSeonq0VH4sS54Cmoq5N1ggslJ0mut35VVgRG.";

        String body = HttpRequest.post(createGoods)
                .header("content-type", "application/json")
                .header("cookie", cookie)
                .header("x-csrf-token", "If0dKjpAmx-g-zc4j4HMUCZ7")
                .body(data).execute().body();
        System.out.println(body);

    }


    /**
     * 全部下架
     */
    static void  bacthDown(String cookie,String _m_h5_tk){

            boolean b = true;
            while (b){
                JSONObject jsonObject = JSONObject.parseObject(list(cookie, _m_h5_tk).body());
                System.out.println(jsonObject.toJSONString());
                JSONObject data1 = jsonObject.getJSONObject("data");

                JSONObject result = data1.getJSONObject("result");
                String goodsList = result.getString("goodsList");
                List<JSONObject> jsonObjects = JSONArray.parseArray(goodsList, JSONObject.class);
                if (jsonObjects.size() < 1){
                    b = false;
                }else {
                    for (JSONObject object : jsonObjects) {
                        String goodsId = object.getString("goodsId");
                        down(cookie,_m_h5_tk,goodsId);
                    }
                }

            }
    }


    private static HttpResponse list(String cookie, String _m_h5_tk){
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.mng.h5.getlistpage/1.0/";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        String data = "{\"page\":1,\"context\":\"{}\",\"cateStatus\":\"cateonsold\"}";
//        String data = "{\"page\":1,\"cateStatus\":\"cateaudit\"}";
        log.info(data);
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data",data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("dataType", "json")
                .form("valueType", "original")
                .form("api", "mtop.jym.jymsell.item.mng.h5.getListPage")
                .form("v", "1.0")
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\",\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\",\"terminal\":\"ios\",\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();
        return rawResponse;
    }

    /**
     * 编辑  只能改价
     */
    static void edit(String cookie,String _m_h5_tk){
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.com.jym.security.core.sendriskevent/1.0/";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        //改价的时候传入商品ID 和 价格
        String goodsId = "1709104295550599";
        String last_price = "1330";

        String data = "{\"eventCode\":\"game_gamecat_prod_updprice\",\"bizScene\":\"game_gamecat_prod_updprice\",\"dataCtx\":\"{\\\"sub_scene\\\":\\\"FrontedGoodsUpdatePrice\\\",\\\"last_price\\\":\\\""+ last_price+"\\\"}\",\"goodsId\": " + goodsId +"}";
        log.info(data);
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data",data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\",\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\",\"terminal\":\"ios\",\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();

        log.info(rawResponse.body());
    }


    /**
     * 下架
     */
    static void down(String cookie,String _m_h5_tk,String goods_id){
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.mng.h5.updatestatus/1.0";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        //下架的时候传入商品ID

        //先查询 recordId
        String highRiskUserRecognitionuRL = "https://m.jiaoyimao.com/api2/user/highRiskUserRecognition";
        JSONObject highJson = new JSONObject();
        highJson.put("recordId","");
        highJson.put("scene","game_gamecat_prod_offsale");
        highJson.put("umidToken",umidToken);
        JSONObject extraPrams = new JSONObject();
        extraPrams.put("p_id_desc",1);
        extraPrams.put("category_name","");
        extraPrams.put("game_name","");
        extraPrams.put("goods_id",goods_id);
        extraPrams.put("ori_price","");
        highJson.put("extraPrams",extraPrams);
        highJson.put("version",1);
        log.info(highJson.toJSONString());


        HttpResponse highRiskUserRes = HttpRequest.post(highRiskUserRecognitionuRL)
                .body(highJson.toJSONString())
//                .header("cookie", "cna=ELz2HdeMWE0CASrvtv8g0GPP; ssids=2151706171272252; logTraceJymId=7979a277a8f7-4ac1-9673-c5c5; track_id=gcmall_1706171272984_20badffa-bff2-468c-ab69-2b489280641e; t=760ce99ede3c17ff4a9854e748e95e99; _bl_uid=bwlgXrU5va1gdbxgmtp0q9ys9p3p; aplus_ieu_ch=10438; ctoken=QLk4nT7MY9W1Ms_5x8BEH0po; xlly_s=1; Hm_lvt_47366dcc92e834539e7e9c3dcc2441de=1707798155,1709021805; _samesite_flag_=true; cookie2=1ac5b7e20db0c4ed82b1b12864f05c97; _tb_token_=e6b53b3379018; sfroms=JIAOYIMALL001; external_login_type=2; EGG_SESS=3v6DgAB-jKbLOzN5Qa1pFi5yHoQKYp1Php5wCXl9Vy7Ix_eco_QOS_jC-0TzxDVnsrktE84L7AheQVsGJ4JQDb6KKG_EzHd85uOlGxc2-IHSUPiqfgb0GIfF9hjMQCbp; csg=ef4d3608; ieu_member_uid=1544521729220323; ieu_member_biz_id=jiaoyimao; jym_session_id=jym0131709085154452172922032301623443200467f0671dabaec526b0cc33ef622451c; ieu_member_sid=jym0131709085154452172922032301623443200467f0671dabaec526b0cc33ef622451c; from=JIAOYIMALL001; modelType=jym_h5; aplus_from=JIAOYIMALL001; aplus_modelType=jym_h5; p_id=b3bb6ad727ff-47ec-a0e1-8545e40c31e3; _m_h5_tk=fcc41f23ba8172e761478a8d5ec3b160_1709112275631; _m_h5_tk_enc=191242c5862a3e16c61cd64656d8ff86; actk=252094e529086d7b1a60f2e9612b724a; ssts=60a29398086b8a9a583b64b9c7fab575; actks=0d45f87f6b46dd0f8d25b33aafc59a6e; t_id=c0a9ff90a446-4f7a-a300-2ad114636aa5; Hm_lpvt_47366dcc92e834539e7e9c3dcc2441de=1709104779; tfstk=e-aX0ub96KvXCJkByt1zNW-NBrg_hR_UBCGTt5L26q3Y5uwbhsD20ozs58HzuxPqkcdteJDq3OD4FPwaUs2Vi5ds68y8CcfmQAH_Q5EVaw7UiS0iWF6F8wPyaO95LOybzmFmSVByaFIFRS2e4urRY9BRBnQ46n8wSFKhrucNcR0bPjiRDSHJSbUmGmkaurT9W1cjcvFxFgSW8vaZ-htiHFGSL_1WjhAlYXpIDe54pmhoZ_15NhrxDbcSL_1WjhmxZbf5N_taD; isg=BFhY-s99ieUrMKQFYOnbbrDkKYbqQbzL-QyZjJJJohNGLewXMlCuWhxLYWMdPXSj")
                .header("content-type", "application/json")
                .header("cookie", cookie)
                .header("referer", "https://m.jiaoyimao.com/rx/goods/manage.html")
                .execute();
        String body = highRiskUserRes.body();

        String recordId = "";
        JSONObject jsonObject = JSONObject.parseObject(body);
        if (Objects.equals(jsonObject.getInteger("stateCode"),200)){
            JSONObject data = jsonObject.getJSONObject("data");
            JSONObject result = data.getJSONObject("result");
            recordId = result.getString("recordId");
        }

        StringBuffer query = new StringBuffer();

        JSONObject data = new JSONObject();
        data.put("itemId",goods_id);
        data.put("action","offsoldgoods");
        data.put("recordId",recordId);

        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data.toJSONString());
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data",data.toJSONString())
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"5611709604019339\",\"ssids\":\"5611709604019339\",\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\",\"terminal\":\"ios\",\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();

        log.info(rawResponse.body());
    }
    /**
     * 撤回
     */
    static void withdraw(String cookie,String _m_h5_tk){
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.mng.h5.updatestatus/1.0/";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        //撤回的时候传入商品ID   下架账号之后 都要先调一下撤回
        String goodsId = "1709102333635115";

        JSONObject data = new JSONObject();
        data.put("itemId",goodsId);
        data.put("action","cancelaudit");

        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data.toJSONString());
        String algSign = DigestUtils.md5Hex(query.toString());
        log.info(algSign);
        log.info(t);
        log.info(cookie);
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data",data.toJSONString())
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\",\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\",\"terminal\":\"ios\",\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();

        log.info(rawResponse.body());
    }

    static void add(String cookie){


        String baseUrl = "https://m.jiaoyimao.com/api2/sellerPublish/createGoods";

        JSONObject data = buildParams("王者荣耀");

        log.info(data.toJSONString());
        HttpResponse createGoodsresponse = HttpRequest.post(baseUrl).body(data.toJSONString())
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/json")
                .header("origin", "https://m.jiaoyimao.com")
                .header("referer", "https://m.jiaoyimao.com/newPublish?type=normal&categoryId=1642580017608072&isSmartPublish=0&clientId=1470047031280559&platformId=3")
                .header("sec-fetch-dest", "empty")
                .header("sec-fetch-mode", "cors")
                .header("user-agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1")
                .header("sec-fetch-site", "same-origin")
                .header("bx-v", "2.2.3")
                .header("cookie", cookie)
                .execute();
        log.info(createGoodsresponse.body());
    }


    static JSONObject buildParams(String gameType){

        JSONObject result = new JSONObject();

        /**
         * 这里以王者荣耀做的数据拼装案例
         *
         */
        if (Objects.equals("王者荣耀",gameType)){
            List<JSONObject> keyProperties = new ArrayList<>();
            JSONObject keyPropertie = new JSONObject();
            keyPropertie.put("propertyName","服务器");
            keyPropertie.put("defaultValue",1498479938499394l);

            List<JSONObject> tags = new ArrayList<>();
            JSONObject tag = new JSONObject();
            tag.put("tagCode","gameServer");
            tags.add(tag);
            keyPropertie.put("tags",tags);
            keyProperties.add(keyPropertie);
            result.put("keyProperties",keyProperties);

            //召唤师等级
            List<JSONObject> extProperties = new ArrayList<>();
            JSONObject extLevel = new JSONObject();
            extLevel.put("propertyId",1642580017625086l);
            extLevel.put("value","30");
            extProperties.add(extLevel);
            //贵族等级
            JSONObject vipLevel = new JSONObject();
            vipLevel.put("propertyId",1642580017634100l);
            vipLevel.put("value","2");
            extProperties.add(vipLevel);
            //段位
            JSONObject level = new JSONObject();
            level.put("propertyId",1642580017638107l);
            level.put("value","白银");
            extProperties.add(level);
            //荣耀水晶数量
            JSONObject shuijing = new JSONObject();
            shuijing.put("propertyId",1642580017692203l);
            shuijing.put("value","20");
            extProperties.add(shuijing);
            //五级铭文数量
            JSONObject mingwqen = new JSONObject();
            mingwqen.put("propertyId",1642580018324633l);
            mingwqen.put("value","10");
            extProperties.add(mingwqen);
            //英雄数量
            JSONObject yingxiong = new JSONObject();
            yingxiong.put("propertyId",1642580017750275l);
            yingxiong.put("value","9");
            extProperties.add(yingxiong);
            //稀有英雄
            JSONObject xiyou = new JSONObject();
            xiyou.put("propertyId",1642580017964154l);
            xiyou.put("value","无");
            extProperties.add(xiyou);
            //皮肤数量
            JSONObject pifu = new JSONObject();
            pifu.put("propertyId",1642580017959146l);
            pifu.put("value","9");
            extProperties.add(pifu);
            //典藏皮肤
            JSONObject diancang = new JSONObject();
            diancang.put("propertyId",1642580017990187l);
            diancang.put("value","无");
            extProperties.add(diancang);
            //限定传说
            JSONObject xianding = new JSONObject();
            xianding.put("propertyId",1642580018247527l);
            xianding.put("value","无");
            extProperties.add(xianding);
            //史诗皮肤
            JSONObject shishi = new JSONObject();
            shishi.put("propertyId",1642580018047260l);
            shishi.put("value","无");
            extProperties.add(shishi);
            //星元皮肤
            JSONObject xingyuan = new JSONObject();
            xingyuan.put("propertyId",1642580018024229l);
            xingyuan.put("value","无");
            extProperties.add(xingyuan);
            //成人号
            JSONObject chengren = new JSONObject();
            chengren.put("propertyId",1642580018332644l);
            chengren.put("value","无");
            extProperties.add(chengren);
            //帐号绑定
            JSONObject zhanghaob = new JSONObject();
            zhanghaob.put("propertyId",1642580018350660l);
            zhanghaob.put("value","5");
            extProperties.add(zhanghaob);
            //实名
            JSONObject shiming = new JSONObject();
            shiming.put("propertyId",1691487392896683l);
            shiming.put("value","可二次实名");
            extProperties.add(shiming);
            //普通传说
            JSONObject putongchuanshuo = new JSONObject();
            putongchuanshuo.put("propertyId",1701153190846854l);
            putongchuanshuo.put("value","无");
            extProperties.add(putongchuanshuo);

            //下面三个不知道是啥，默认无
            JSONObject def = new JSONObject();
            def.put("propertyId",1646274229975286l);
            def.put("value","无");
            extProperties.add(def);
            def = new JSONObject();
            def.put("propertyId",1646276359287233l);
            def.put("value","无");
            extProperties.add(def);
            def = new JSONObject();
            def.put("propertyId",1707120222323824l);
            def.put("value","无");
            extProperties.add(def);
            def = new JSONObject();
            result.put("extProperties",extProperties);

            List<JSONObject> safeProperties = new ArrayList<>();
            for (JSONObject extProperty : extProperties) {
                JSONObject safePropertie = new JSONObject();
                Long propertyId = extProperty.getLong("propertyId");
                String value = extProperty.getString("value");
                safePropertie.put("propertyId",propertyId);
                safePropertie.put("value",value);
                safeProperties.add(safePropertie);
            }
            result.put("safeProperties",safeProperties);

            List<JSONObject> sellerAccountProperties = new ArrayList<>();
            //qq账号
            JSONObject sellerAccount = new JSONObject();
            sellerAccount.put("propertyId","1642580017622083");
            sellerAccount.put("value","1343701877");
            sellerAccountProperties.add(sellerAccount);
            //qq密码
            JSONObject sellerPwd = new JSONObject();
            sellerPwd.put("propertyId","1642580017630093");
            sellerPwd.put("value","qwer1234");
            sellerAccountProperties.add(sellerPwd);
            //手机号
            JSONObject sellerTel = new JSONObject();
            sellerTel.put("propertyId","1642580018345655");
            sellerTel.put("value","17737053518");
            sellerAccountProperties.add(sellerTel);
            result.put("sellerAccountProperties",sellerAccountProperties);


            List<JSONObject> performanceProperties = new ArrayList<>();
            result.put("performanceProperties",performanceProperties);
            List<JSONObject> goodsSellingScene = new ArrayList<>();
            result.put("goodsSellingScene",goodsSellingScene);
            List<JSONObject> fulfillmentSelect = new ArrayList<>();
            result.put("fulfillmentSelect",fulfillmentSelect);

            //价格标题等属性
            result.put("price",200);
            result.put("title","不经常玩，看上的联系");
            result.put("description","不经常玩，看上的联系");
            result.put("storage","1");
            JSONObject insuranceRef = new JSONObject();
            insuranceRef.put("current",null);
            result.put("insuranceRef",insuranceRef);

            //图片
            List<JSONObject> imageIdList = new ArrayList<>();
            JSONObject imgJson = new JSONObject();
            imgJson.put("url","https://static-cdn.jiaoyimao.com/jym-oss/resource/item/1544521729220323/20240227/98814f5027274f43a79737e53c1e662a.jpg");
            imgJson.put("onlinePath","/jym-oss/resource/item/1544521729220323/20240227/98814f5027274f43a79737e53c1e662a.jpg");
            imgJson.put("width","800");
            imgJson.put("height","650");
            imgJson.put("originFileSize","603169");
            imgJson.put("compressFileSize","94837");
            imgJson.put("status","1");
            imgJson.put("failReason","找不到图片对应场景");
            imgJson.put("recognizeId","7168164386461586947");
            imageIdList.add(imgJson);
            result.put("imageIdList",imageIdList);

            JSONObject gameProperty = new JSONObject();
            gameProperty.put("platformId","3");
            gameProperty.put("pid","1");
            gameProperty.put("cid","1642580017608072");
            gameProperty.put("clientId","1470047031280559");
            gameProperty.put("gameId","1002416");
            gameProperty.put("isNineGameAccount","false");
            gameProperty.put("isLingXiAccount","false");
            gameProperty.put("isAliGameAccount","false");
            gameProperty.put("isTransfer","false");
            gameProperty.put("platformName","苹果");
            gameProperty.put("serverId","1498479938499394");
            gameProperty.put("isSupportImageRecognize","true");
            gameProperty.put("isFinishAccount","true");
            gameProperty.put("categoryName","QQ帐号（旧）");
            result.put("gameProperty",gameProperty);

            result.put("modelType","H5");
            result.put("categoryId","1642580017608072");
            result.put("categoryId","1642580017608072");

            JSONObject addlService = new JSONObject();
            addlService.put("supportBargain",false);
            result.put("addlService",addlService);
            result.put("publishMode",1);
            result.put("isImageRecognize",true);
            result.put("securityModelType","h5_ios");
            result.put("goodsDefTravelContent","{\"forceBargain\":true}");

        }
        return result;
    }


    static HttpResponse getToken() {
        String t = String.valueOf(new Date().getTime());
        String token = "e2a7c26a6f259abbfbf16c92baa01906";
        String _m_h5_tk = token + "_" + t;
        //先请求一个cookie为空

        HttpResponse response = getRes(null, t, token, null);
        String body = response.body();
        log.info("第一次请求={}", body);


        return response;
    }


    public static HttpResponse getRes(String cookie, String t, String token, String data) {

        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.com.jym.layout.hsf.goodslist.getgoodslist/1.0/";
        String jsv = "2.7.2";
        String s = "12574478";

        StringBuffer query = new StringBuffer();
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse response = HttpRequest.get(baseUrl)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .form("type", "originaljson")
                .form("v", "1.0")
                .form("valueType", "original")
                .form("dataType", "json")
                .form("api", "mtop.com.jym.layout.hsf.goodslist.getGoodsList")
                .form("preventFallback", "true")
                .form("data", data)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"5541701826074943\",\"ssids\":\"5541701826074943\",\"platform\":\"JYM_IOS_TOUCH\",\"plat\":\"JYM_IOS_TOUCH\",\"osCode\":\"ios\",\"chCode\":\"h5\",\"ch\":\"10438\",\"vername\":\"\"}")
                .header("cookie", cookie)
                .execute();
        return response;
    }


}
